function [xpdata,n_prefparms,n_groomchars] = import_and_setup_expost(spec) 

    % import ex-post data
%---------------------
expostdata = csvread('../Data/initial_data/expost_data.csv', 0,0);

size(expostdata)

% bride characteristics
EP_ed_bride1 = expostdata(:,24);
EP_age_bride1 = expostdata(:,22);
EP_ed_bride2 = expostdata(:,25);
EP_age_bride2 = expostdata(:,23);

% match characteristics
EP_gov_job1 = expostdata(:,20);
EP_age_groom1 = expostdata(:,12);
EP_ed_groom1 = expostdata(:,18);
EP_wealth_groom1 = expostdata(:,14);
EP_dowry_groom1 = expostdata(:,16);

G1=[EP_gov_job1 EP_age_groom1 EP_ed_groom1 EP_ed_groom1==13 EP_wealth_groom1==2 EP_wealth_groom1==3 EP_dowry_groom1];
n_groomchars=size(G1,2);

EP_gov_job2 = expostdata(:,21);
EP_age_groom2 = expostdata(:,13);
EP_ed_groom2 = expostdata(:,19);
EP_wealth_groom2 = expostdata(:,15);
EP_dowry_groom2 = expostdata(:,17);

% instruments
EP_homehelp = expostdata(:,9);
EP_like_bride = expostdata(:,10);
EP_cost_bride = expostdata(:,11);

EP_like_x_ed1 = EP_like_bride.*(EP_ed_bride1-7);
EP_like_x_ed2 = EP_like_bride.*(EP_ed_bride2-7);

EP_cost_x_ed1 = EP_cost_bride.*EP_ed_bride1;
EP_cost_x_ed2 = EP_cost_bride.*EP_ed_bride2;

EP_help_x_age1 = EP_homehelp.*EP_age_bride1;
EP_help_x_age2 = EP_homehelp.*EP_age_bride2;

G2=[EP_gov_job2 EP_age_groom2 EP_ed_groom2 EP_ed_groom2==13 EP_wealth_groom2==2 EP_wealth_groom2==3 EP_dowry_groom2];


EP_choice = (expostdata(:,26)==1);

j=1;
for i=[8:13] % different education levels
    EP_ed_bride1_d(:,j)=EP_ed_bride1==i;
    EP_ed_bride2_d(:,j)=EP_ed_bride2==i;
    j=j+1;
end 

j=1;
for i=[13:17 19:22] % different age dummies (18 is the excluded category)
    EP_age_bride1_d(:,j)=EP_age_bride1==i;
    EP_age_bride2_d(:,j)=EP_age_bride2==i;
    j=j+1;
end 

% ex-post: put all utility-relevant characteristics into matrices for each
% option
if spec==0
X1=[G1,  EP_age_bride1_d, EP_ed_bride1_d];
X2=[G2,  EP_age_bride2_d, EP_ed_bride2_d];
end

if spec==1
X1=[G1, EP_like_x_ed1, EP_cost_x_ed1, EP_help_x_age1, EP_age_bride1_d, EP_ed_bride1_d];
X2=[G2, EP_like_x_ed2,  EP_cost_x_ed2, EP_help_x_age2, EP_age_bride2_d, EP_ed_bride2_d];
end


if spec==2 % NB IN RESULTS TABLE IT IS PRESENTED AS "(EP_ed_bride1-7)" AND TRANSFORMED BY HAND. 
X1=[G1, EP_like_x_ed1,  EP_age_bride1, (EP_age_bride1-18).*(EP_age_bride1>17), (EP_ed_bride1-7), EP_ed_bride1==13];
X2=[G2, EP_like_x_ed2,  EP_age_bride2, (EP_age_bride2-18).*(EP_age_bride2>17), (EP_ed_bride2-7), EP_ed_bride2==13];
end

n_prefparms=size(X1,2)-1;

xpdata.X1=X1;
xpdata.X2=X2;
xpdata.EP_choice=EP_choice;
xpdata.id=expostdata(:,2);
end